home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / RKPLUS20.ARJ / RKPDEMO.PAS < prev    next >
Pascal/Delphi Source File  |  1991-02-08  |  5KB  |  189 lines

  1. Program RkpDemo;
  2.  
  3. {
  4.  This is a demonstration program using rkPlus.
  5.  It uses 2 registration levels (0 and 1).
  6.  If a Level 1 key has expired, it will be treated as Level 0.
  7.  If a Level 0 key has expired, it will be treated as Unregistered.
  8.  This is a very simple program that doesn't actually do anything, but it
  9.  should demonstrate some of what can be done with rkPlus.
  10. }
  11.  
  12.  
  13. Uses
  14.   Crt, Dos, RkPlus;
  15.  
  16.  
  17. Const
  18.   RkpDemoVer = '3.4';
  19.   MonthNames : Array[1..12] of String[3]
  20.   = ('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
  21.  
  22.  
  23. Var
  24.   kc : Char;
  25.  
  26.  
  27. Procedure BadRegBeep;
  28.  
  29. Begin
  30.   Sound(1200);
  31.   Delay(200);
  32.   Sound(600);
  33.   Delay(200);
  34.   Sound(1200);
  35.   Delay(200);
  36.   Sound(600);
  37.   Delay(200);
  38.   NoSound;
  39. End;
  40.  
  41.  
  42. Procedure NotRegBeep;
  43.  
  44. Begin
  45.   Sound(600);
  46.   Delay(200);
  47.   Sound(1200);
  48.   Delay(200);
  49.   NoSound;
  50. End;
  51.  
  52.  
  53. Procedure DoView;
  54.  
  55. Begin
  56.   WriteLn('Sample data :');
  57.   WriteLn;
  58.   WriteLn('4.465536  7.918270  0.118373  5.367233');
  59.   WriteLn('1.396349  4.868343  7.079323  4.783021');
  60.   WriteLn('3.947924  8.864673  8.846264  2.999999');
  61.   WriteLn('8.490832  6.874378  5.338329  3.729270');
  62.   WriteLn('6.839882  8.873478  6.750373  7.018948');
  63.   WriteLn('5.034784  3.003763  3.253290  4.892387');
  64.   WriteLn('3.874378  8.314159  9.880869  3.987842');
  65.   WriteLn('2.764947  9.265358  4.013002  9.903278');
  66. End;
  67.  
  68.  
  69. Procedure DoCalc;
  70.  
  71. Begin
  72.   If (Reg.Status = Registered) then Begin
  73.     Write('The calculated result is ');
  74.     WriteLn(4.465536+7.918270+0.118373+5.367233+1.396349+4.868343+7.079323+4.783021
  75.     +3.947924+8.864673+8.846264+2.999999+8.490832+6.874378+5.338329+3.729270
  76.     +6.839882+8.873478+6.750373+7.018948+5.034784+3.003763+3.253290+4.892387
  77.     +3.874378+8.314159+9.880869+3.987842+2.764947+9.265358+4.013002+9.903278);
  78.   End Else
  79.     WriteLn('Only available in registered version!');
  80. End;
  81.  
  82.  
  83. Procedure DoTest;
  84.  
  85. Begin
  86.   If (Reg.Status = Registered) then Begin
  87.     If (Reg.Level > 0) then Begin
  88.       Write('Performing tests...');
  89.       Delay(300);
  90.       WriteLn;
  91.       WriteLn('All tests passed.');
  92.     End Else
  93.       WriteLn('Not available in demo version!');
  94.   End Else
  95.     WriteLn('Only available in registered version!');
  96. End;
  97.  
  98.  
  99. Begin
  100.   If BadSystemDate then Begin
  101.     WriteLn('You must correctly set your system clock to run RkpDemo!');
  102.     BadRegBeep;
  103.     Halt(1);
  104.   End;
  105.   OwnerCode := 'ArgleBarbWotsLeeb';
  106.   ProgramCode := 'RkpDemo Three';
  107.   KeyFile := 'RKPDEMO';
  108.   GetRegInfo;
  109.   Write('RkpDemo ' + RkpDemoVer);
  110.   If (Reg.Status in [InvalidKey, FileError, InvalidFile]) then
  111.     WriteLn(' [invalid]')
  112.   Else If (Reg.Status = Registered) and (Reg.Level > 0) then
  113.     WriteLn(' [registered]')
  114.   Else If (Reg.Status = Registered) then
  115.     WriteLn(' [demo]')
  116.   Else
  117.     WriteLn(' [unregistered]');
  118.   WriteLn('(c) 1991 TrendSoft, Inc.');
  119.   WriteLn;
  120.   If (Reg.Status in [InvalidKey, FileError, InvalidFile]) then Begin
  121.     WriteLn(Reg.KeyPath+' has been altered!');
  122.     WriteLn('Please contact TrendSoft, Inc. to obtain a valid key file.');
  123.     BadRegBeep;
  124.     Halt(1);
  125.   End Else If (Reg.Status = ExpiredKey) then Begin
  126.     If (Reg.Level > 0) then Begin
  127.       WriteLn('Your registration key has expired!');
  128.       WriteLn('You will be given access at the DEMO level.');
  129.       WriteLn('Contact TrendSoft, Inc. to renew your registration.');
  130.       NotRegBeep;
  131.       Reg.Level := 0;
  132.     End Else Begin
  133.       WriteLn('Your limited use demo key has expired!');
  134.       WriteLn('You will be given access at the UNREGISTERED level.');
  135.       WriteLn('Contact TrendSoft, Inc. to register.');
  136.       NotRegBeep;
  137.       Reg.Status := NotRegistered;
  138.     End;
  139.   End Else If (Reg.Status = Registered) then Begin
  140.     If (Reg.Level > 0) then Begin
  141.       WriteLn('This version of RkpDemo is registered to '+Reg.Name1);
  142.       If (Reg.ExpYear <> 0) and (Reg.ExpMonth <> 0) then
  143.         WriteLn('This registration will expire ','1-',MonthNames[Reg.ExpMonth],'-',Reg.ExpYear,'.');
  144.       WriteLn('Thank you for registering!');
  145.     End Else Begin
  146.       WriteLn('This version of RkpDemo is a limited use demo for '+Reg.Name1);
  147.       If (Reg.ExpYear <> 0) and (Reg.ExpMonth <> 0) then
  148.         WriteLn('This limited use demo will expire ','1-',MonthNames[Reg.ExpMonth],'-',Reg.ExpYear,'.');
  149.       WriteLn('Don''t forget to register!');
  150.     End;
  151.   End Else Begin
  152.     WriteLn('This version of RkpDemo is unregistered.');
  153.     WriteLn('Contact TrendSoft, Inc. to register or obtain a limited use demo key.');
  154.     NotRegBeep;
  155.     Delay(500);
  156.   End;
  157.   WriteLn;
  158.   WriteLn('RkpDemo ' + RkpDemoVer + ' Menu');
  159.   WriteLn;
  160.   WriteLn('[V]iew sample data');
  161.   Write('[C]alculate');
  162.   If (Reg.Status <> Registered) then
  163.     WriteLn('  (only available in registered version)')
  164.   Else
  165.     WriteLn;
  166.   Write('[T]est results');
  167.   If (Reg.Status < Registered) then
  168.     WriteLn('  (only available in registered version)')
  169.   Else If (Reg.Level <= 0) then
  170.     WriteLn('  (not available in demo version)')
  171.   Else
  172.     WriteLn;
  173.   WriteLn;
  174.   Write('Selection : ');
  175.   kc := UpCase(ReadKey);
  176.   WriteLn;
  177.   WriteLn;
  178.   Case kc of
  179.   'V' :
  180.     DoView;
  181.   'C' :
  182.     DoCalc;
  183.   'T' :
  184.     DoTest;
  185.   Else
  186.     WriteLn('Invalid selection!');
  187.   End;
  188. End.
  189.